package test.util;

import java.util.LinkedList;

public class DuiLieUtils {
	
	private static LinkedList list;
	
	private static DuiLieUtils utils;
	
    public static DuiLieUtils getDuiLieUtils(){
    	if(utils!=null) {
    		return utils;
    	}
    	list = new LinkedList<>();
    	utils = new DuiLieUtils();
        return utils;
    }
    
    public void add(Object obj){
        list.add(obj);
    }
    
    public Object get(){
        return list.removeFirst();   
    }
    
    public boolean isNull(){
        return list.isEmpty();
    }   
    
    public static void main(String[] args) {
    	DuiLieUtils dl = DuiLieUtils.getDuiLieUtils();
        dl.add("abc1");
        dl.add("abc2");
        dl.add("abc3");
        dl.add("abc4");
        while(!dl.isNull()){
            System.out.println(dl.get());
        }
   }
}
